﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasertTemplates.Master" AutoEventWireup="true" ViewStateMode="Disabled" CodeBehind="Businessnature.aspx.cs" Inherits="WebApplication.Businessnature" %>
<%@ Register TagPrefix="uc1" TagName="usermeg" Src="~/UserControl/UserMessageControl.ascx" %>
<%@ Register TagPrefix="uc1" TagName="maintab" Src="~/UserControl/MainTabControl.ascx" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<script type="text/javascript">

    $(document).ready(function () {
        var Related = $("#ContentPlaceHolder2_hidStrNatureUID").val();
        var subCatList = Related.split(',');
        if (subCatList.length > 0) {
            $.each(subCatList, function (thiskey, thisval) {
                $("input[value='" + thisval + "']").attr("checked", true);
            });
        }
        //tab2 selected
        //checkTab("t5");
    })

    function GetInfo() {
        if ($("#ContentPlaceHolder2_lkBtnSave").hasClass("aspNetDisabled").toString() != "true") {
            $("#ContentPlaceHolder2_lblMeg").html("数据正在处理,请稍候...");
            var strNeedToDel = "";
            var strNeedToAdd = "";
            var Related = $("#ContentPlaceHolder2_hidStrNatureUID").val();
            var subCatList = Related.split(',');
            //找出需要删除的UID
            if (subCatList.length > 0) {
                $.each(subCatList, function (thiskey, thisval) {
                    if ($("input[value='" + thisval + "']").attr("checked") == false) {
                        strNeedToDel += thisval + ",";
                    }
                });
                $("#ContentPlaceHolder2_hidNeedToDel").val("").val(strNeedToDel);
            }
            //找出需要增加的UID
            $(".clsulList input:checked").each(function () {
                var isNeedToAdd = true;
                var checkval = $(this).val();
                $.each(subCatList, function (ToComparekey, tocompareval) {
                    if (checkval == tocompareval) {
                        isNeedToAdd = false;
                        return false;
                    }
                });
                if (isNeedToAdd)
                { strNeedToAdd += checkval + ","; }
            });
            $("#ContentPlaceHolder2_hidNeedToAdd").val("").val(strNeedToAdd);
        }
    }
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    
 <input type="hidden" value="t5" id="pageName" />
 <div class="content-title"><h1>Customer - Business Nature</h1></div> 
         <div class="con-nav"><a href="#" class="btn"><span class="ui-icon ui-icon-newwin"></span>Add New Customer</a>
               </div>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder2" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
<uc1:usermeg ID="usermeg" runat="server" ></uc1:usermeg>
 
    <div class="partWrap">
    <uc1:maintab ID="maintab"  runat="server"/>
    <div class="clear20"></div>
    
<div class="CheckWrap">
    <ul class="clsulList labelTb">
        <asp:Repeater ID="rptNatureList"  runat="server" EnableViewState="false">
            <ItemTemplate>
                <li><input id='nt_<%# Eval("BusNatureUID")%>' type="checkbox" value='<%# Eval("BusNatureUID")%>' /><label for='nt_<%# Eval("BusNatureUID")%>'><%# Eval("BusNature_Eng") + " " + Eval("BusNature_Chi")%></label></li>
            </ItemTemplate>
        </asp:Repeater>
    </ul>
    
    <asp:CheckBoxList ID="ckbNatureList" runat="server" RepeatLayout="Table" RepeatDirection="Horizontal" Width="100%"  RepeatColumns="3"  class="labelTb" >
    </asp:CheckBoxList>
<div class="clear20"></div>
  	<table width="200" border="0" cellspacing="0" cellpadding="0">
			  <tr>
				<td width="80">
				 <ul class="uibtn">
    	            <li> 
                    <asp:UpdatePanel ID="UpdatePanel2" runat="server">
                    <ContentTemplate>
                        <asp:LinkButton ID="lkBtnSave"  runat="server"  OnClientClick="return GetInfo()" onclick="btnSave_Click">Save</asp:LinkButton>
                         </ContentTemplate>
                     </asp:UpdatePanel>
                   </li>
	            </ul>
				</td>
				<td>
				 <ul class="uibtn">
    	            <li><span>Quit</span></li>
	            </ul>
				</td>
			  </tr>
              <tr><td colspan="2">
              <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                    <ContentTemplate>
                        <asp:HiddenField ID="hidStrNatureUID" runat="server" />
                        <asp:Label ID="lblMeg" CssClass="clsWarningMeg" runat="server"></asp:Label>
                        <asp:HiddenField ID="hidNeedToAdd" runat="server" />
                        <asp:HiddenField ID="hidNeedToDel" runat="server" />
                  </ContentTemplate>
             </asp:UpdatePanel>
                  </td></tr>
			</table>
</div>
    </div>
</asp:Content>
